<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
	<meta charset="UTF-8"/>
	<title>后台登录</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link th:href="@{/css/font.css}" rel="stylesheet" />
    <link th:href="@{/css/xadmin.css}" rel="stylesheet" />
    <link th:href="@{/lib/layui/css/layui.css}" rel="stylesheet" />
</head>
<body class="login-bg">
    <div class="login layui-anim layui-anim-up">
        <div class="message">闪打-管理登录111</div>
        <div id="darkbannerwrap"></div>
        <form method="post" class="layui-form" >
            <input name="username" id="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" />
            <hr class="hr15"/>
            <input name="password" id="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input" />
            <hr class="hr15"/>
            <input value="登录" lay-filter="userlogin" style="width:100%;" type="button" id="buttons" />
            <hr class="hr20" />
            <p style="color: red;"></p>
        </form>
    </div>
<script th:src="@{/js/jquery-3.2.1.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:inline="javascript">
   $(document).keyup(function(event){
	  if(event.keyCode ==13){
	    $("#buttons").trigger("click");
	  }
	});
  $("#buttons").click(function () {
		var url =[[${#httpServletRequest.getContextPath()}]]+'/system/userlogin';
	    $.ajax({
			cache : false,
			type : "POST",
			url : url,
			async : false,
			dataType : "json",
			data : {
				userId : $("#username").val(),
				password : $("#password").val()
			},
			success : function(data) {
				/* <![CDATA[ */
				if(data != null){
					if(data.success){
						 window.location.href=[[${#httpServletRequest.getContextPath()}]]+'/system/main?userId='+data.content.userId; 
					}else{
                      if($("#username").val() != null && $("#password").val()){
                    	  layer.msg(data.message);
					  }
					}
				}
				/* ]]> */
			}
   }); 
  }) 
</script>
</body>
</html>